<!-- @format -->

<template>
  <!-- 头部组件 -->
  <div
    class="my-header"
    :style="{ backgroundColor: bgColor, color: textColor }"
  >
    {{ title }}
  </div>
</template>

<script>
  export default {
    props: {
      bgColor: {
        type: String,
        default: 'purple'
      },
      textColor: {
        type: String,
        default: '#fff'
      },
      title: {
        type: String,
        required: true
      }
    }
  }
</script>

<style scoped>
  /* 头部样式 */
  .my-header {
    height: 45px;
    line-height: 45px;
    text-align: center;
    background-color: #1d7bff;
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 2;
  }
</style>
